﻿using System;
using System.Collections.Specialized;
using System.Collections.ObjectModel;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SoccerSimulator5000
{
    public class Game
    {
        public static bool initialized = false;
        public static Player player;
        public static Season season;
        public static Schedule schedule;
        public static Date date;
        public static List<Team> teamList = new List<Team>();
        public static Random random = new Random();
        public static int previousSimSpeed = 0;
        public static int currentRound = 0;


        public Game()
        {
            //Game.teamList.Add(new Team("Barkaby Kickers", (float)95, (float)85, (float)95, (float)85));
            //Game.teamList.Add(new Team("Friska Fläktar BK", (float)95, (float)85, (float)95, (float)85));
            //Game.teamList.Add(new Team("BK Stenhård", (float)95, (float)85, (float)95, (float)85));
            //Game.teamList.Add(new Team("Olles Favoriter", (float)95, (float)85, (float)95, (float)85));
            //Game.teamList.Add(new Team("Mammas Pojkar", (float)95, (float)85, (float)95, (float)85));
            //Game.teamList.Add(new Team("Allas IK", (float)95, (float)85, (float)95, (float)85));
            //Game.teamList.Add(new Team("Gråsuggorna United", (float)95, (float)85, (float)95, (float)85));
            //Game.teamList.Add(new Team("Real City", (float)95, (float)85, (float)95, (float)85));
            //Game.teamList.Add(new Team("FK Folkan", (float)95, (float)85, (float)95, (float)85));
            //Game.teamList.Add(new Team("Hufvudstaden United", (float)95, (float)85, (float)95, (float)85));
            //Game.teamList.Add(new Team("Förortens underdogs", (float)95, (float)85, (float)95, (float)85));
            //Game.teamList.Add(new Team("Luftens hjältar", (float)95, (float)85, (float)95, (float)85));

            //player = new Player();
            //season = new Season();
            //schedule = new Schedule();
            //date = new Date();
            
            
        }

        public static void Init()
        {
            Game.teamList.Add(new Team("Barkaby Kickers"));
            Game.teamList.Add(new Team("Friska Fläktar BK"));
            Game.teamList.Add(new Team("BK Stenhård"));
            Game.teamList.Add(new Team("Olles Favoriter"));
            Game.teamList.Add(new Team("Mammas Pojkar"));
            Game.teamList.Add(new Team("Allas IK"));
            Game.teamList.Add(new Team("Gråsuggorna United"));
            Game.teamList.Add(new Team("Real City"));
            Game.teamList.Add(new Team("FK Folkan"));
            Game.teamList.Add(new Team("Hufvudstaden United"));
            Game.teamList.Add(new Team("Förortens Underdogs"));
            Game.teamList.Add(new Team("Luftens Hjältar"));

            for (int i = 0; i < Game.teamList.Count(); i++)
            {
                Game.teamList[i].standingsData.position = i + 1;
                Game.teamList[i].Init();
            }

            //player = new Player();
            //season = new Season();
            //schedule = new Schedule();
            //date = new Date();
        }

        // Part of attempt to solve load-problem.
        public static void AddTeams()
        {
            Game.teamList.Add(new Team("Barkaby Kickers"));
            Game.teamList.Add(new Team("Friska Fläktar BK"));
            Game.teamList.Add(new Team("BK Stenhård"));
            Game.teamList.Add(new Team("Olles Favoriter"));
            Game.teamList.Add(new Team("Mammas Pojkar"));
            Game.teamList.Add(new Team("Allas IK"));
            Game.teamList.Add(new Team("Gråsuggorna United"));
            Game.teamList.Add(new Team("Real City"));
            Game.teamList.Add(new Team("FK Folkan"));
            Game.teamList.Add(new Team("Hufvudstaden United"));
            Game.teamList.Add(new Team("Förortens Underdogs"));
            Game.teamList.Add(new Team("Luftens Hjältar"));

            for (int i = 0; i < Game.teamList.Count(); i++)
            {
                Game.teamList[i].standingsData.position = i + 1;
            }
        }

        public Game(string playerName, string teamName, float forward, float midfield, float defender, float goalie)
        {
            player = new Player(playerName, teamName, forward, midfield, defender, goalie);
            season = new Season();
        }

    }
}
